package demo;

import mini.spring.core.SimpleBeanFactory;
import demo.service.OrderService;

public class Main {
    public static void main(String[] args) {
        SimpleBeanFactory factory = new SimpleBeanFactory();

        // 先扫描并注册
        factory.scanPackage("demo.service");

        // 调试：确认注册完毕（scanPackage 已打印）
        OrderService orderService = (OrderService) factory.getBean("orderService");
        orderService.placeOrder();

        // 测试循环依赖包
        factory.scanPackage("demo.circular");
        Object a = factory.getBean("a");
        Object b = factory.getBean("b");
        System.out.println("A -> " + a);
        System.out.println("B -> " + b);
    }
}
